function grin(a) {
    var d;
    a = "" + a + "";
    if (!document.getElementById("comment") || document.getElementById("comment").type != "textarea") return !1;
    d = document.getElementById("comment");
    if (document.selection) d.focus(), sel = document.selection.createRange(), sel.text = a, d.focus(); else if (d.selectionStart || d.selectionStart == "0") {
        var c = d.selectionStart, b = d.selectionEnd, e = b;
        d.value = d.value.substring(0, c) + a + d.value.substring(b, d.value.length), e += a.length, d.focus(), d.selectionStart = e, d.selectionEnd = e;
    } else d.value += a, d.focus();
}

var i = 0, got = -1, len = document.getElementsByTagName("script").length;

while (i <= len && got == -1) {
    var js_url = document.getElementsByTagName("script")[i].src, got = js_url.indexOf("comments-ajax.js");
    i++;
}

var edit_mode = "0", save_url = "http://www.smzdmya.com/message/save.html", wp_url = js_url.substr(0, js_url.indexOf("wp-content")), pic_sb = wp_url + "/images/wpspin_dark.gif", pic_no = wp_url + "/images/no.png", pic_ys = wp_url + "/images/yes.png", txt1 = '<div id="loading"><img src="' + pic_sb + '" style="vertical-align:middle;" alt=""/> 正在提交, 请稍候...</div>', txt2 = '<div id="error">#</div>', txt3 = '"><img src="' + pic_ys + '" style="vertical-align:middle;" alt=""/> 提交成功。', txt4 = '"><img src="' + pic_ys + '" style="vertical-align:middle;" alt=""/> 提交成功。若您的评论未显示，不是小编手快删帖，而是您的评论需审核，请谅解', edt1 = ', 刷新页面之前可以<a rel="nofollow" class="comment-reply-link" href="#edit" onclick=\'return addComment.moveForm("', edt2 = ")'>再编辑</a>", cancel_edit = "取消编辑", edit, num = 1, comm_array = [];

comm_array.push(""), jQuery(document).ready(function(c) {
    function a() {
        $new_comm.show(), $new_sucs.show(), c("textarea").each(function() {
            this.value = "";
        }), edit = "";
    }
    function b() {
        d > 0 ? ($submit.val(d), d--, setTimeout(b, 1e3)) : ($submit.val(e).attr("disabled", !1).fadeTo("slow", 1), d = 15);
    }
    $comments = c("#comments-title"), $cancel = c("#cancel-comment-reply-link"), cancel_text = $cancel.text(), $submit = c("#commentform #submit"), $submit.attr("disabled", !1), c("#loading").hide(), c("#error").hide(), $body = window.opera ? document.compatMode == "CSS1Compat" ? c("html") : c("body") : c("html,body"), c("#commentform").submit(function() {
        return c("#loading").slideDown(), $submit.attr("disabled", !0).fadeTo("slow", .5), edit && c("#comment").after('<input type="text" name="edit_id" id="edit_id" value="' + edit + '" style="display:none;" />'), c.ajax({
            "type": "POST",
            "url": save_url,
            "data": c(this).serialize(),
            "dataType": "json",
            "success": function(f) {
                if (f.result == "ok") {
                    c("#loading").hide(), comm_array.push(c("#comment").val()), c("textarea").each(function() {
                        this.value = "";
                    });
                    var j = addComment, g = j.I("wp-temp-form-div"), o = j.I(j.respondId), h = j.I("comment_post_ID").value;
                   $("#message_success").css('display','');
                   b(), num++, edit = "", c("*").remove("#edit_id"),g && o && (g.parentNode.insertBefore(o, g), g.parentNode.removeChild(g));                   
                } else f.result == "no" && (c("#loading").slideUp(), c("#error").slideDown().html('<img src="' + pic_no + '" style="vertical-align:middle;" alt=""/> ' + f.message), setTimeout(function() {
                    $submit.attr("disabled", !1).fadeTo("slow", 1), c("#error").slideUp();
                }, 3e3));
            }
        }), !1;
    }), addComment = {
        "moveForm": function(j, k, p, h, l) {
            var u = this, f, o = u.I(j), g = u.I(p), s = u.I("cancel-comment-reply-link"), q = u.I("comment_parent"), r = u.I("comment_post_ID");
            edit && a(), q == "0" ? l ? (u.I("comment").value = comm_array[l], $new_sucs = c("#success_" + l), $new_sucs.hide(), edit = c("#li-comment-new").innerHTML.match(/(comment-)(\d+)/)[2], $new_comm = c("#li-comment-new"), $new_comm.hide(), $cancel.text(cancel_edit)) : $cancel.text(cancel_text) : l ? (u.I("comment").value = comm_array[l], $new_sucs = c("#success_" + l), $new_sucs.hide(), edit = u.I(".cdc-comment-new-" + q).innerHTML.match(/(comment-)(\d+)/)[2], $new_comm = c(".cdc-comment-new-" + q), $new_comm.hide(), $cancel.text(cancel_edit)) : $cancel.text(cancel_text), u.respondId = p, h = h || !1, u.I("wp-temp-form-div") || (f = document.createElement("div"), f.id = "wp-temp-form-div", f.style.display = "none", g.parentNode.insertBefore(f, g)), o ? o.parentNode.insertBefore(g, o.nextSibling) : (temp = u.I("wp-temp-form-div"), u.I("comment_parent").value = "0", temp.parentNode.insertBefore(g, temp), temp.parentNode.removeChild(temp)), $body.animate({
                "scrollTop": c("#respond").offset().top - 180
            }, 400), r && h && (r.value = h), q.value = k, s.style.display = "", s.onclick = function() {
                edit && a();
                var w = addComment, v = w.I("wp-temp-form-div"), x = w.I(w.respondId);
                return w.I("comment_parent").value = "0", v && x && (v.parentNode.insertBefore(x, v), v.parentNode.removeChild(v)), this.style.display = "none", this.onclick = null, !1;
            };
            try {
                u.I("comment").focus();
            } catch (m) {}
            return !1;
        },
        "I": function(f) {
            return document.getElementById(f);
        }
    };
    var d = 15, e = $submit.val();
});